<%@ page import="java.util.List" %>
<%@ page import="com.bjpowernode.user.User" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" +
            request.getServerPort() + request.getContextPath() + "/";
%>
<html>
<head>
    <title>Title</title>
    <base href="<%=basePath%>">
    <%
        String name = (String) session.getAttribute("username");
        List<User> userList = (List<User>) session.getAttribute("userList");
        String sou = (String) session.getAttribute("sou");
    %>
    <style type="text/css">
        *{
            margin: 0;
            padding: 0;
        }
    </style>
    <script type="text/javascript" src="jQuery/jquery-3.5.1.js"></script>
    <script type="text/javascript">
        function clickFollow(id){
            $.ajax({
                url:"follow/add.do",
                data:{
                    username:"<%=name%>",
                    gzid:id
                },
                success:function(response){
                    alert(response);
                }
            })
        }
    </script>
</head>
<body>
<%
    if (userList.size() == 0){
%>
<center>
    <div style="background: white;width: 850px;height: 50px;line-height: 50px;margin-top: 10px">
        没有查询到与“<%=sou%>”有关的用户！
    </div>
</center>
<%
    }
    for (int i = 0; i<userList.size();i++){
%>
<center>
    <div id="user" align="left" style="background: white;width: 850px;height: 80px">
        <table style="margin-left: 100px;height: 70px">
            <tr>
                <td style="cursor: pointer"><a href="user/findXinxi.do?name=<%=userList.get(i).getUsername()%>" target="_top"><%=userList.get(i).getUsername()%></a></td>
                <td>
                    <div onclick="clickFollow(<%=userList.get(i).getId()%>)" style="cursor: pointer;width: 70px;height: 30px;margin-top: 2px;margin-left: 10px;border: 1px solid #a7a7a7;line-height: 30px">
                        <font style="color: rgb(248,93,0);margin-left: 10px"><b>+</b></font>关注
                    </div>
                </td>
            </tr>
        </table>
        <hr>
    </div>
</center>
<%
    }
%>
</body>
</html>
